﻿@page
    @inject SettingService _settingService
@inject Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Mvc.RazorPages.RazorPagesOptions> _razorPageOption
@{
    ViewBag.Title = "站点关闭";
}

@functions{
    string ShowMessage { get; set; }
    public IActionResult OnGet()
    {
        var siteSetting= _settingService.GetGeneralSetting();
        if (siteSetting.IsClosed && !User.Identity.IsAuthenticated && !User.IsInRole("Administrator"))
        {
            this.ShowMessage = siteSetting.CloseReason;
            return Page();
        }
        return RedirectToPage("Index");
    }
}

<div class="row justify-content-center text-center"">
    
    <div class="alert col-6">
        <h2>当前站点已关闭
        </h2>
        <hr />
            @if (this.ShowMessage.IsNullOrWhiteSpace())
    {
        <span><i class="fa fa-info-circle"></i> 当前站点已由管理员关闭</span>
}
else
{
        @Html.Raw(this.ShowMessage)
}
    </div>
</div>